﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using MediaPortal.Database;
using MediaPortal.Configuration;
using SQLite.NET;

namespace BierdopjeTV.Helpers
{
    static class SqliteHelper
    {
        static private SQLiteClient _Client;

        static public void OpenDatabase()
        {
            Database.createDatabase.CheckIfTablesExist();
            _Client = new SQLiteClient(Config.GetFile(Config.Dir.Database, "BierdopjeTV.db3").ToString());
            Helpers.Logger.WriteSimpel("Using database : " + Config.GetFile(Config.Dir.Database, "BierdopjeTV.db3").ToString());
        }


        static public SQLiteResultSet ExecuteQuery(string Query)
        {
            if (_Client == null)
            {
                OpenDatabase();
            }
            return _Client.Execute(Query);        
        }

        static public void CloseDatabase()
        {
            _Client.Close();
        }


    }
}

